#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,sum,b[200005],t;
int read(){
	int x=0;
	char c=getchar();
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+c-'0',c=getchar();
	return x;
}
struct c{
	int g,h;
}a[200005];
signed main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	n=read();
	int m=n;
	for(int i=1;i<=n;i++) a[i].g=read(),a[i].h=i; 
	while(m!=0){
		int x,y;
		sum=0;
		for(int i=1;i<=n;i++){
			if(a[i].g!=-1) {
				x=a[i].g;
				y=a[i].h;
				break;
			}
		}
		a[y].g=-1;
		printf("%lld ",y);
		for(int i=y+1;i<=n;i++){
			if(a[i].g!=-1){
				if(a[i].g!=x) {
					x=a[i].g;
					printf("%lld ",a[i].h);
					a[i].g=-1;
					sum++;
				}
			}
		}
		puts("");
		m-=sum+1;
	}
	return 0;
}
